package com.cqut.forum.action;

import java.util.Map;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

/**
 * 连接跳转controller
 * @author yangxun
 */
@Controller
public class RedirectAction {
	private String url;
	
	@RequestMapping("/main/redirect")
	public String exitAction(String url){
		return url+".html";
	}
	
	@RequestMapping("/visit/visit_picture")
	public String visitPictre(Map<String, Object> map,int targetId,
			boolean isgroup,String loadUrl){
		boolean pictureModule = true;
		map.put("targetId", targetId);
		map.put("isgroup", isgroup);
		if(loadUrl==null){
			loadUrl = "/networkforum/picture/visit_picture.do?option=picture_id&asc=true"
				+"&targetId="+targetId+"&isgroup="+isgroup;
			pictureModule = false;
		}
		map.put("loadUrl", loadUrl);
		map.put("pictureModule", pictureModule);
		
		return "/pages/picture/picture_show.jsp";
		/*height
		publishTime
		pictureSrc
		userPhoto
		userName
		replyTime
		
		height
		publishTime
		image
		visitTime
		replyTime
		pictureId*/
	}
	
	@RequestMapping("/visit/visit_user")
	public String visitUser(Map<String, Object> map,int targetId){
		map.put("targetId", targetId);
		return "/pages/user/user_show.jsp";
	}
	
	/*************get and set method*******************/
	public String getUrl() {
		return url;
	}
	public void setUrl(String url) {
		this.url = url;
	}
}
